module BulkMail
  def self.addresses_by_domain(list)
    list.inject({}) do |m, addr|
      if (addr =~ /<(.*)@(.*)>/) or (addr =~ /(.*)@(.*)/)
        domain = $2
        m[domain] ||= []
        m[domain] << addr
      end
      m
    end
  end
end